<template>
  <div class="search">
    <div class="container">
      <div class="screen">
        <span>当前筛选：</span>
        <ul class="list-box">
          <li class="product">
            品牌：鞍钢，柳钢
            <i class="iconfont icon-close-btn close-btn" @click="closeNape" />
          </li>
        </ul>
        <span class="eliminate" @click="eliminateBtn">清除全部</span>
      </div>
      <div class="search-box">
        <div class="site utility">
          <span>收货地址：</span>
          <div class="site-box">
            <span class="site-input" @click="openMap">
              <el-input
                v-model="site"
                class="input-style text-line-1"
                placeholder="点击选择收货地址"
              />
              <i slot="prefix" class="iconfont icon-site site" />
            </span>
            <div class="site-content num" @click="openInput">
              <span>采购数量：</span>
              <el-input-number
                v-model="num"
                :min="1"
                :max="10"
                :disabled="true"
                @change="handleChange"
              />
              <span class="unit">吨</span>
            </div>
          </div>
        </div>
        <div class="brand utility">
          <span>品牌：</span>
          <div class="trademark">
            <ul class="brand-list word-break">
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
            </ul>
            <div v-show="more" class="more">
              更多
              <i class="iconfont icon-arrow-bottom arrow" />
            </div>
          </div>
        </div>
        <div class="brand utility">
          <span>分类：</span>
          <div class="trademark">
            <ul class="brand-list word-break">
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
              <li>鞍钢</li>
            </ul>
            <div v-show="more" class="more">
              更多
              <i class="iconfont icon-arrow-bottom arrow" />
            </div>
          </div>
        </div>
        <div class="serve utility">
          <span>服务：</span>
          <div class="condition" @click="lookCondition">仅看库存充足</div>
        </div>
      </div>
      <div class="tab-list">
        <div>全部</div>
        <div class="price">
          <span>价格</span>
          <div class="arrows">
            <i class="iconfont icon-up-arrows up-btn" @click="upArrows" />
            <i class="iconfont icon-below-arrows below-btn" @click="belowArrows" />
          </div>
        </div>
      </div>
      <div class="product-list">
        <ul>
          <li class="list">
            <div class="list-left">
              <div class="img" />
            </div>
            <div class="list-right">
              <div class="list-one overall">
                <div class="name">白水泥</div>
                <div class="name">越秀仓库</div>
                <div class="name">100.00元/吨</div>
                <div class="name">采购数量：1吨</div>
              </div>
              <div class="list-two overall">
                <div class="name">采购数量：1吨</div>
                <div class="name">商品总价：<span>￥1288</span></div>
                <div class="name">运费总价：<span>￥1288</span></div>
                <div class="name">总计：<span>￥1288</span></div>
              </div>
              <div class="list-three">
                <i class="iconfont icon-phone-num relation" @click="information" />
              </div>
            </div>
          </li>
          <li class="list">
            <div class="list-left">
              <div class="img" />
            </div>
            <div class="list-right">
              <div class="list-one overall">
                <div class="name">白水泥</div>
                <div class="name">越秀仓库</div>
                <div class="name">100.00元/吨</div>
                <div class="name">采购数量：1吨</div>
              </div>
              <div class="list-two overall">
                <div class="name">采购数量：1吨</div>
                <div class="name">商品总价：<span>￥1288</span></div>
                <div class="name">运费总价：<span>￥1288</span></div>
                <div class="name">总计：<span>￥1288</span></div>
              </div>
              <div class="list-three">
                <i class="iconfont icon-phone-num relation" @click="information" />
              </div>
            </div>
          </li>
          <li class="list">
            <div class="list-left">
              <div class="img" />
            </div>
            <div class="list-right">
              <div class="list-one overall">
                <div class="name">白水泥</div>
                <div class="name">越秀仓库</div>
                <div class="name">100.00元/吨</div>
                <div class="name">采购数量：1吨</div>
              </div>
              <div class="list-two overall">
                <div class="name">采购数量：1吨</div>
                <div class="name">商品总价：<span>￥1288</span></div>
                <div class="name">运费总价：<span>￥1288</span></div>
                <div class="name">总计：<span>￥1288</span></div>
              </div>
              <div class="list-three">
                <i class="iconfont icon-phone-num relation" @click="information" />
              </div>
            </div>
          </li>
        </ul>
      </div>
      <div class="page">
        <el-pagination background layout="prev, pager, next" :total="1000" />
      </div>
    </div>
    <el-dialog
      :title="title"
      :visible.sync="quantityInput"
      width="538px"
      class="dialog"
      :before-close="handleClose"
    >
      <div class="purchase">
        <span>采购数量：</span>
        <el-input v-model="range" />
        <span class="unit">吨/m³</span>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="quantityCertain">确 定</el-button>
        <el-button @click="quantityCall">取 消</el-button>
      </span>
    </el-dialog>
    <el-dialog
      :title="title"
      :visible.sync="relation"
      width="30%"
      :before-close="handleClose"
    >
      <div class="relation-box">
        <div><span>联系人：</span><span>王老板</span></div>
        <div><span>联系电话：</span><span>13265034453</span></div>
        <div><span>办公电话：</span><span>020-38373230</span></div>
      </div>
    </el-dialog>
    <ChooseMap v-if="showMap" @concel="concel" @submitMap="submitMap" />
  </div>
</template>

<script>
import ChooseMap from '@/components/ChooseMap'
export default {
  components: {
    ChooseMap
  },
  props: {
    // eslint-disable-next-line vue/require-default-prop
    site: String
  },
  data() {
    return {
      more: true,
      input: '',
      num: 1,
      showMap: false,
      value: '',
      range: '',
      quantityInput: false,
      relation: false,
      title: '',
      state: '',
      mapData: {}
    }
  },
  methods: {
    // 上箭头
    upArrows() {
      console.log('点击上箭头')
    },
    // 下箭头
    belowArrows() {
      console.log('点击下箭头')
    },
    // 查看库存按钮
    lookCondition() {
      console.log('查看库存')
    },
    // 关闭筛选项按钮
    closeNape() {
      console.log('关闭筛选项')
    },
    // 清除按钮
    eliminateBtn() {
      console.log('清除选项')
    },
    handleChange(value) {
      console.log(value)
    },
    // 点击收货地址弹出地图
    openMap() {
      this.showMap = true
    },
    concel() {
      this.showMap = false
    },
    submitMap(address) {
      console.log(address, '00000000')
      this.site = address.receiveProvince + '' + address.receiveCity + '' + address.receiveAddress
      // this.ruleForm.address = address
      this.showMap = false
      this.$store.commit('PAGE_MAP', address)
      // latitude 精度
      // longitude 纬度
      console.log(this.$store.getters.shopPageMap.latitude, '================')
      //       addressTitle: "广州市天河区中山大道西"
      // latitude: 23.138018
      // longitude: 113.374182
      // receiveAddress: "天河区中山大道西棠下上社牌坊"
      // receiveCity: "广州市"
      // receiveDistrict: ""
      // receiveProvince: "广东省"
    },
    openInput() {
      this.quantityInput = true
      this.title = '采购数量'
      this.state = 0
    },
    information() {
      this.relation = true
      this.title = '联系方式'
    },
    handleClose() {
      this.quantityInput = false
      this.relation = false
    },
    quantityCall() {
      this.quantityInput = false
    },
    quantityCertain() {
      this.quantityInput = false
    }
  }
}
</script>

<style lang='scss' scoped >
.search {
  background: #f5f5f5;
  .container {
    .screen{
      display: flex;
      font-size: 10px;
      align-items: center;
      height: 28px;
      line-height: 28px;
      color: #A7A7AA;
      .list-box{
        display: flex;
        align-items: center;
        .product{
          line-height: 17px;
          padding: 0 6px;
          background: #ffffff;
          height: 17px;
          margin-right: 10px;
          .close-btn{
            cursor: pointer;
            font-size: 14px;
          }
        }
      }
      .eliminate{
        cursor: pointer;
      }
    }
    .search-box {
      background: #ffffff;
      padding: 30px 0 30px 30px;
      margin-bottom: 20px;
      .utility {
        display: flex;
        line-height: 30px;
        position: relative;
        .brand-list {
          display: flex;
          flex-wrap: wrap;
          width: 1050px;
          li {
            margin-right: 20px;
          }
        }
        .more{
          position: absolute;
          right: 40px;
          top: 0;
          width: 70px;
          height: 28px;
          line-height: 23px;
          border: 1px solid #E5E5E5;
          text-align: center;
          color:#8E8E93;
          cursor: pointer;
          .arrow{
            font-size: 20px;
          }
        }
        .condition{
          cursor: pointer;
        }
      }
      .nature {
        .amend {
          width: 102px;
          height: 21px;
          background: #02a9f1;
          color: #ffffff;
          text-align: center;
          line-height: 21px;
          font-size: 12px;
          cursor: pointer;
          margin-left: 20px;
          border-radius: 4px;
        }
      }
      .site-box {
        display: flex;
        align-items: center;
        .site-input{
          position: relative;
          .site{
            position: absolute;
            left: 12px;
            color: #8E8E93;
          }
        }
        .site-content {
          display: flex;
          align-items: center;
          margin-left: 76px;
          .unit {
            margin-left: 16px;
          }
        }
      }
    }
    .tab-list {
      height: 44px;
      margin-bottom: 24px;
      background: #ffffff;
      display: flex;
      line-height: 44px;
      padding-left: 20px;
      .price {
        margin: 0 52px;
        width: 100px;
        display: flex;
        .arrows{
          display: flex;
          flex-direction: column;
          .up-btn{
            font-size: 10px;
            height: 12px;
            margin-top: -4px;
            margin-left: 4px;
            cursor: pointer;
            color: #666666;
          }
          .below-btn{
            cursor: pointer;
            font-size: 10px;
            margin-left: 4px;
            color: #666666;
          }
        }
      }
    }
    .product-list {
      background: #ffffff;
      margin-bottom: 40px;
      .list {
        display: flex;
        padding: 14px 0 20px 20px;
        border-bottom: 1px solid #e5e5e5;
        .list-left {
          display: flex;
          .img {
            width: 80px;
            height: 80px;
            background: forestgreen;
            margin-right: 44px;
          }
          .left-detail {
            line-height: 26px;
            .color {
              color: #c7c7cc;
              font-size: 10px;
            }
          }
        }
        .list-right {
          display: flex;
          flex-direction: column;
          line-height: 24px;
          .overall {
            display: flex;
            span {
              color: #ff3b30;
            }
          }
          .list-one {
            .name{
              width: 256px;
            }
          }
          .list-two {
            .num {
              padding-right: 28px;
            }
            .shop{
              margin-right: 4px;
            }
            .name{
              width: 256px;
            }
          }
          .list-three {
            width: 32px;
            height: 32px;
          }
        }
      }
      .list:last-child {
        border-bottom: none;
      }
    }
    .page {
      display: flex;
      justify-content: center;
      margin-bottom: 60px;
    }
  }
  .purchase {
    display: flex;
    align-items: center;
    justify-content: center;
    .unit {
      margin-left: 15px;
    }
  }
  .range-box {
    display: flex;
    align-items: center;
    justify-content: center;
    .unit {
      margin-left: 15px;
    }
  }
  .relation-box {
    display: flex;
    justify-content: center;
    flex-direction: column;
    font-size: 14px;
    color: #6b6b6b;
    padding-left: 178px;
    line-height: 34px;
  }

  /deep/ .input-style {
    .el-input__inner {
      text-indent: 24px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      display: inline-block;
      width: 100%;
    }
  }
  //
  /deep/ .input {
    .el-input {
      height: 28px;
      width: 217px;
    }
  }
  /deep/ .range-style {
    width: 100px;
    .el-input__inner {
      width: 100px;
    }
  }
  /deep/ .search-box {
    .el-form-item {
      width: 350px;
    }
    .el-input__inner {
      height: 28px;
    }
    .el-input-number {
      height: 28px;
      line-height: 26px;
    }
  }

  /deep/ .search-box {
    .el-form-item__label {
      width: 106px !important;
    }
  }
  /deep/.site-input {
    .el-input {
      width: 230px;
    }
  }
  /deep/ .range {
    .el-input {
      width: 74px;
    }
  }
  /deep/ .num {
    .el-input-number {
      width: 134px;
    }
  }
  /deep/ .range-box {
    .el-input {
      width: 126px;
    }
  }
  /deep/ .purchase {
    .el-input {
      width: 126px;
    }
  }
  /deep/ .dialog {
    .el-dialog__footer {
      display: flex;
      justify-content: center;
      .el-button--primary {
        width: 110px;
        height: 37px;
        background: #ff3b30;
        color: #ffffff;
        border: none;
      }
      .el-button--default {
        width: 110px;
        height: 37px;
        border: 1px solid #e5e5e5;
        background: #e5e5e5;
        color: #6b6b6b;
      }
    }
  }
  /deep/ .amending {
    display: flex;
    justify-content: center;
    padding-right: 91px;
    .el-input {
      width: 236px;
    }
  }
}
</style>
